Byte endianess is an attribute of data storage and retrieval where the data storage and data retrieval support multiple access sizes. Finer granularity accesses allow a programmer to see the order in which the larger accesses store bytes in memory. Big endian data are stored in memory in opposite byte order from little endian data. Little endian data are stored with its least significant byte in the lowest memory byte address (storing left to right). Big endian data are stored with its most significant byte in the lowest memory byte address (storing right to left). Big and little endian variables having the same value are identical in CPU registers, but have differing order in memory.
Source code that is written using one byte endianess convention cannot be executed on a platform or target system that is of another byte endianess convention without recognizing the differing order of how some of the data is stored in memory. For example, in order to preserve correct software behavior, an endian byte ordering within data must be preserved when a union or pointer access might make such order visible to the programmer. Byte order for data written or read from beyond the scope of the program must also be preserved.
In the past, some platforms were configured with a mode bit that could be set to support the execution of source code written in one byte endian convention or the other. This approach, however, applied the support to all code running on the platform and thus did not address the problem of running a big endian program on a little endian operating system.
Thus, what is needed is an efficient and effective method and apparatus for executing code written in one endianess convention on a computer system platform of a differing endianess convention.